public class LogIn {

    /*private String userName="admin";
    private String passWord="1234";

    public void loginInfo(String userName,String passWord)
    throws UserNameException,PasswordException{
        if (!this.userName.equals(userName)){
            throw new UserNameException("用户名错误");
        }
        if (!this.passWord.equals(passWord)){
            throw new PasswordException("密码错误");
        }
        System.out.println("登录成功");
    }

    public static void main(String[] args) {
        LogIn logIn=new LogIn();
        try {
            logIn.loginInfo("admin1","12324");
        }catch (UserNameException e){
            e.printStackTrace();
            System.out.println("UserNameException");
        }catch (PasswordException e){
            e.printStackTrace();
            System.out.println("PasswordException");
        }

    }*/

    public String userNmae="admin";
    public String passWord="123";

    public void loginInfo(String userName,String passWord)
    throws UserNameException,PasswordException{
        if (!this.userNmae.equals(userName)){
            throw new UserNameException("用户名错误");
        }
        if (!this.passWord.equals((passWord))){
            throw new PasswordException("密码错误");
        }
        System.out.println("登录成功");
    }

    public static void main(String[] args) {
        LogIn logIn=new LogIn();
        try {
            logIn.loginInfo("admin","123");
        }catch (UserNameException e){
            e.printStackTrace();
            System.out.println("UserNameException");
        }catch (PasswordException e){
            e.printStackTrace();
            System.out.println("PasswordException");
        }
    }

}
